package com.linfeng.business.admin.domain.aggregate.impl;

import com.linfeng.business.admin.aggregate.AdminAggregateRoot;
import com.linfeng.business.admin.domain.entity.SysAdminEntity;
import com.linfeng.business.admin.dto.data.admin.SysAdminDTO;
import com.linfeng.component.common.response.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/domain/admin")
public class AdminAggregateRootImpl implements AdminAggregateRoot {

    @Resource
    private SysAdminEntity sysAdminEntity;

    @Override
    @GetMapping(value = "/v1/loginName/{loginName}")
    public ResponseEntity<SysAdminDTO> detailByLoginName(@PathVariable(value = "loginName") String loginName) {

        return ResponseEntity.body(sysAdminEntity.getByLoginName(loginName));
    }
}
